package cz.cuni.mff.ufal.volk.command;

public class AmbientCommand extends Command {
  
  public AmbientCommand(Type type, byte left, byte right) {
    this.type = type;
    this.left = left;
    this.right = right;
  }
  
  private final Type type;
  private final byte left;
  private final byte right;

  @Override
  public byte commandType() {
    return 0x04;
  }

  @Override
  public byte[] getBytes() {
    byte[] bytes = new byte[type.length];
    bytes[0] = (byte)0x7f;
    bytes[1] = (byte)0xff;
    bytes[2] = (byte)0xff;
    bytes[3] = (byte)0xff;
    bytes[type.length - 2] = left;
    bytes[type.length - 1] = right;
    return bytes;
  }
  
  public static enum Type {
    // TODO rename items
    ITEM_1(22),
    ITEM_2(23),
    ITEM_3(24);
    
    final int length;
    
    private Type(int length) {
      this.length = length;
    }
  }

}
